Skip to content

fix: add helpful suggestions to generator error messages (fixes #1728)#2177

Closed
gavin913427-hash wants to merge 1 commit into
asyncapi:masterfrom
gavin913427-hash:fix/generate-error-message
Closed

fix: add helpful suggestions to generator error messages (fixes #1728)#2177
gavin913427-hash wants to merge 1 commit into
asyncapi:masterfrom
gavin913427-hash:fix/generate-error-message

Conversation

@gavin913427-hash
Copy link
Copy Markdown

What does this PR do?

Adds helpful suggestions to generator error messages when asyncapi generate fromTemplate fails (fixes #1728)

Changes

Enhanced error handling in src/apps/cli/commands/generate/fromTemplate.ts to detect common failure patterns and suggest actionable fixes:

  • Template not found (ENOENT/not found): Suggests installing the template first
  • Invalid document (parse/syntax errors): Suggests validating the document with asyncapi validate
  • 404 errors: Suggests checking the template name on npm

Before

Error: ENOENT: no such file or directory

After

Error: ENOENT: no such file or directory

Possible causes:
  - The template may not be installed. Try installing it first with: npm install <template-name>

Related issue(s)

Fixes #1728

Checklist

  • Added error pattern detection for common failures
  • Added actionable suggestions
  • Preserved original error message when no patterns match
  • Added changeset

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 4, 2026

🦋 Changeset detected

Latest commit: 091c168

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@asyncapi/cli Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 4, 2026

@github-project-automation github-project-automation Bot moved this from To Triage to Done in CLI - Kanban May 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[Improvement]: Improve the error message while generating project fromgenerate command

2 participants